package com.apes.scm.voucher.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.scm.voucher.model
 * @ClassName: VoucherExtension
 * @Author: pyb
 * @Description: 业务凭证扩展表
 * @CreateTime: 2021-03-12 11:33
 * @Version: 1.0
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = VoucherExtension.CONST_TABLE_NAME)
public class VoucherExtension extends BaseModel {
    public static final String CONST_TABLE_NAME = "acc_voucher_extension";
    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "业务凭证扩展表")
    @Comment("凭证扩展表单号")
    private long id;

    @Column(name = "voucher_item_id", length = 30)
    @Comment("凭证明细单号")
    private long voucherItemId;

    @Column(name = "company_name", length = 30)
    @Comment("公司名称")
    private String companyName;

    @Column(name = "partner_name", length = 30)
    @Comment("合作伙伴名称")
    private String partnerName;

    @Column(name = "supplier_name", length = 30)
    @Comment("供应商名称")
    private String supplierName;

    @Column(name = "dept_name", length = 30)
    @Comment("部门名称")
    private String deptName;

    @Column(name = "clerk", length = 36)
    @Comment("业务员")
    private String clerk;

    @Column(name = "contract", length = 36)
    @Comment("合同")
    private String contractName;

    @Column(name = "product_name", length = 100)
    @Comment("商品名称")
    private String productName;

    @Column(name = "product_classify", length = 100)
    @Comment("商品分类")
    private String productClassify;

    @Column(name = "product_classify_id", length = 100)
    @Comment("商品分类编码")
    private String productClassifyId;

    @Column(name = "product_group", length = 100)
    @Comment("商品组名称")
    private String productGroupName;

    @Column(name = "category_id", length = 100)
    @Comment("商品类目")
    private String categoryId;

    @Column(name = "category_name", length = 100)
    @Comment("商品类目名称")
    private String categoryName;

    @Column(name = "brand_name", length = 100)
    @Comment("品牌名称")
    private String brandName;

    @Column(name = "product_state", length = 10)
    @Comment("商品状态")
    private String productState;


    @Column(name = "serve_type_id", length = 10)
    @Comment("服务类型编码")
    private String serveTypeId;

    @Column(name = "serve_type_name", length = 10)
    @Comment("服务类型")
    private String serveTypeName;

    @Column(name = "uom_name", length = 10)
    @Comment("计量单位名称")
    private String uomName;

    @Column(name = "tax_name", length = 10)
    @Comment("税率")
    private String taxName;


    @Column(name = "origin_business_type", length = 32)
    @Comment("源单据类型名称")
    private String originBusinessTypeName;

    @Column(name = "source_business_type", length = 32)
    @Comment("来源单据类型名称")
    private String sourceBusinessTypeName;


    @Column(name = "realname", length = 32)
    @Comment("客户名称")
    private String realname;

    @Column(name = "mobile", length = 32)
    @Comment("客户手机号")
    private String mobile;


    @Column(name = "car_license", length = 64)
    @Comment("车牌号码")
    private String carLicense;

    @Column(name = "vin", length = 64)
    @Comment("车架号")
    private String vin;

    @Column(name = "jekun_model_code", length = 64)
    @Comment("配置车型编码")
    private String jekunModelCode;

    @Column(name = "car_model_label", length = 256)
    @Comment("配置车型名称")
    private String carModelLabel;

    @Column(name = "CAR_SERVICE_LEVEL_NAME", length = 64)
    @Comment("车型服务等级")
    private String carServiceLevel;

    @Column(name = "book_date")
    @Comment("记账日期")
    private Date bookDate = new Date();

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "origin_company_id", referencedColumnName = "id")
    @Comment("来源单据公司（异业）")
    private PartyRole originCompany;

}
